import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import user from './modules/user'
import global from './modules/global'
import settings from './modules/settings'
import getters from './getters'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    user,
    settings,
    global
  },
  getters,
  plugins: [
    createPersistedState({
      storage: window.localStorage,
      reducer(state, paths) {
        return {
          user: state.user,
          app: state.app,
          global: state.global
        }
      }
    })
  ]
})

export default store
